package com.lqd.mall.system;

import com.lqd.mall.basis.constant.ParamTypeConstants;
import com.lqd.mall.basis.response.CommonResult;
import com.lqd.mall.basis.response.Result;
import com.lqd.mall.interaction.basis.vo.TableDataInfoVo;
import com.lqd.mall.interaction.system.SysUserEntity;
import com.lqd.mall.interaction.system.vo.LoginUserVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

/**
 * @author 零起点
 * @create 2022-02-20 0:26
 */
@RequestMapping("user")
@Api(tags = "用户信息维护模块")
public interface SysUserLoginControllerApi {


    @GetMapping("info/{username}")
    @ApiOperation("根据用户名称,获取用户信息")
    @ApiImplicitParam(name = "username", value = "用户名称", paramType = ParamTypeConstants.PATH)
    Result<LoginUserVo> getUserInfo(@PathVariable("username") String username);

    @GetMapping("getInfo")
    Result<Map<String, Object>> getInfo();

    @GetMapping("profile")
    Result<Map<String, Object>> profile();

    @PutMapping("profile")
    CommonResult upateUserLogin(@RequestBody SysUserEntity entity);

    @PutMapping("profile/updatePwd")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "oldPassword",value = "原始密码",paramType = ParamTypeConstants.FORM),
            @ApiImplicitParam(name = "newPassword",value = "新的密码",paramType = ParamTypeConstants.FORM)
    })
    CommonResult updatePwd(String oldPassword, String newPassword);

    @GetMapping("list")
    Result<TableDataInfoVo<SysUserEntity>> listEntity(SysUserEntity entity);

    @GetMapping("{userId}")
    Result< SysUserEntity> listEntity(@PathVariable("userId") Long userId);
}
